package com.huilian.iotbox.admin.dao;

import com.huilian.iotbox.data.dto.OrderDto;
import com.huilian.iotbox.data.po.Order;
import com.huilian.iotbox.data.vo.OrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 谢洛涛
 * @date 2021/1/9 12:22
 */
@Mapper
public interface OrderDao {

    Integer insert(OrderDto orderDto);

    List<OrderVo> findAdminOrderList(OrderDto orderDto);

    OrderVo findAdminOrderStatistics(OrderDto orderDto);

    /**
     * 统计当天的销售额,利润,交易笔数,销量(游戏币)
     *
     * @return
     */
    OrderVo findCountDay(OrderDto orderDto);

    /**
     * 根据时间查找订单
     *
     * @param startTime
     * @param endTime
     * @return
     */
    List<OrderVo> findDateOrder(@Param("agencyId") Integer agencyId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    OrderDto getById(Long orderId);

    Integer updateStatusById(Order order);

    Order findOldOrder(Long orderId);

    Integer delete(@Param("endTime") String endTime);

    /**
     * 查询支付成功的交易金额
     *
     * @param orderDto
     * @return
     */
    OrderVo findSuccessTotalAmount(OrderDto orderDto);

    List<OrderVo> findSuccessTotalAmountList(OrderDto orderDto);

    Order findOneOrderByCondition(Order condition);

    List<OrderVo> findDenominationCountByDeviceNo(OrderDto orderDenomination);

    List<OrderVo> findTurnoverOfflineGroupByDeviceNo(OrderDto orderDenomination);

    /**
     * 修改订单表数据, 抖音回调那边使用
     */
    Integer updateOrderDouYinData(OrderDto orderDto);

    /**
     * 根据id删除order表数据
     */
    Integer deleteOrderById(Long id);

    /**
     * 根据outTradeNo查询订单
     */
    OrderVo findOrderOneByOutTradeNo(String outTradeNo);


    List<OrderVo> findExportTheQueryOrderList(OrderDto orderDto);

    int  findExportTheQueryOrderCount(OrderDto orderDto);

    OrderVo getOneOrderByDeviceNo(String deviceNo, Integer userId, Integer merchantStoreId);
}
